// 植物卡片类
let bgCard = document.querySelector('#plantsCard')

class PlantsCard {
    constructor (obj) {
        let s = {
            x:obj.x,
            y:obj.y,
            id:obj.id,
            type:obj.type,
            path:obj.path
        }
        Object.assign(this,s)
    }
    draw(){
        // 绘制卡片上植物
        let img = new Image()
        img.src = './images/'+this.path
        img.className = 'plantsCard'
        img.style.width = '80px'
        img.style.height = '90px'
        img.id = 'plantsCard' + this.id
        img.setAttribute('type',this.type)
        bgCard.appendChild(img)
    }
}

